<template>
    <div class="box">
        <div class="Duihuan banxin">
            <div class="title tanxin">
                <div class="title_l">
                    <img :src="src" alt="" />
                    <h2>{{title}}</h2>
                </div>
                <div class="more" v-show="title!=='积分攻略'">
                    <span>更多</span>
                    <img src="../../assets/images/home/Arrow.png" alt="" />
                </div>
            </div>
            <div class="content">
                <img src="../../assets/images/home/ad.png" alt="">
                <ul class="tanxin">
                    <li v-for="(item) in datas" :key="item.index">
                        <img class="img-hot" src="../../assets/images/home/hot-j.png" alt="">
                        <div class="li-box">
                            <img class="img-bg" :src="'http://sc.wolfcode.cn'+item.coverImg" alt="">
                        </div>
                        <div class="li-box2">
                            <h3>{{item.name}}</h3>
                            <span>{{item.coin}}<img src="../../assets/images/home/monad.png"></span>
                            <div>立即兑换</div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>

<script>
import { DuihuanApi } from '@/request/api';
export default {
    data() {
        return {
            datas: ''
        }
    },
    created() {
        DuihuanApi().then(res => {
            this.datas = res.data.data.data.records
            console.log(res);
        })
    },
    props: ["title", "src"]
};
</script>
 
<style lang = "less" scoped>
@import "../../assets/base.less";

.box {
    background: #F7F7F7;
}

.title {
    align-items: center;
    height: 106px;

    .title_l {
        display: flex;

        h2 {
            font-size: 30px;
            font-weight: bold;
            color: @black;
            margin-left: 10px;
        }
    }

    .more {
        span {
            font-size: 16px;
            color: #666666;
            margin-right: 6px;
        }
    }
}

.content ul {
    justify-content: left;
    align-items: center;
    flex-wrap: wrap;
    li {
        position: relative;
        margin-right: 20px;
        margin-top: 20px;
        width: 285px;
        height: 412px;
        background-color: #fff;
        transition: 1s;

        .img-hot {
            position: absolute;
            width: 50px;
            height: 50px;
        }

        .img-bg {
            width: 100%;
            height: 265px;
        }

        .li-box {
            width: 100%;
            height: 250px;
        }

        .li-box2 {
            position: relative;
            width: 100%;
            height: 162px;
            text-align: center;

            h3 {
                padding: 30px 0;
            }

            span {
                color: orange;
                display: flex;
                justify-content: center;
                align-items: center;

                img {
                    width: 20px;
                    height: 20px;
                    padding: 0 10px;
                }
            }

            div {
                position: absolute;
                width: 100px;
                height: 30px;
                border: 1px solid #666666;
                text-align: center;
                line-height: 30px;
                left: 50%;
                top: 70%;
                transform: translate(-50%);
            }

            div:hover {
                background-color: cyan;
                color: white;
            }
        }
    }
    li:nth-child(4){
        margin-right: 0;
    }

    li:hover {
        transform: translateY(-15px);
    }
}
</style>